package com.yy.wga.resource.service.controller;


import com.yy.wga.common.dto.Result;
import com.yy.wga.module.resource.request.GetResourceRequest;
import com.yy.wga.module.resource.request.ListResourceRequest;
import com.yy.wga.module.resource.response.GetResourceResponse;
import com.yy.wga.module.resource.response.ListResourceResponse;
import com.yy.wga.module.resource.service.ResourceConfigService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 资源位配置
 *
 * @author guochao
 * @since 2024-10-31 22:48:51
 */
@RestController
@RequestMapping("api/resource/config")
public class ResourceConfigController {
    /**
     * 服务对象
     */
    @Resource
    private ResourceConfigService resourceConfigService;

    /**
     * 获取资源位信息
     * @param request
     * @return
     */
    @Deprecated
    @PostMapping("get")
    public Result<List<GetResourceResponse>> get(@Validated @RequestBody GetResourceRequest request) {
        return Result.success(resourceConfigService.get(request));
    }
    /**
     * 获取资源位信息V2
     * @param request
     * @return
     */
    @PostMapping("list")
    public Result<List<ListResourceResponse>> list(@Validated @RequestBody ListResourceRequest request) {
        return Result.success(resourceConfigService.listData(request));
    }
}
